<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page import="com.esurvey.core.*" %>
<%@ page import="java.sql.Date" %>
<HTML>
<HEAD>
	<TITLE>eSurvey - Confirmaci&oacute;n creaci&oacute;n de categor&iacute;a</TITLE>
	<LINK href="styles/general.css" type="text/css" rel="stylesheet">
	<LINK href="styles/addCategory.css" type="text/css" rel="stylesheet">
	<SCRIPT src="jquery/jquery.js" type="text/javascript"></SCRIPT>
	<SCRIPT src="js/global.js" type="text/javascript"></SCRIPT>
	<STYLE>
		div#main {
			margin-left: 30px;
		}
	</STYLE>
</HEAD>
<%
if ((session.getAttribute("kind") == "admin") && (request.getParameter("categoryName") != null)) {
	try {
		String categoryName =(String) request.getParameter("categoryName");
		if (! eSurveyPersistence.categoryNameExists(categoryName)) {
			Category c = new Category(categoryName);
			eSurveyPersistence.createCategory(c);
%>
<BODY>
<DIV id="general">
	<DIV id="header">
		<%@ include file="header.jsp" %>
	</DIV>
	<DIV id="content">
		<DIV id="main">
			<H1>La categor&iacute;a '<%= request.getParameter("categoryName") %>' ha sido creada correctamente con el identificador '<%= c.getId() %>'</H1>
			<P>Puedes volver al men&uacute; de administraci&oacute;n de categor&iacute;as pulsando <A href="adminCategories.jsp">aqu&iacute;</A></P>
		</DIV>
		<DIV id="nav">
			<DIV class="tabs">
				<%@ include file="adminTabs.html" %>
			</DIV>
		</DIV>
	</DIV>
	<DIV id="footer">
		<%@ include file="footer.jsp" %>
	</DIV>
</DIV>
</BODY>
<%
		} else {
			response.sendRedirect("addNewCategory.jsp?categoryNameDuplicate="+categoryName);
		}
	} catch (Exception e) {
		response.sendRedirect("error.jsp?exception="+e);
	}
} else {
		response.sendRedirect("login.jsp");
}
%>
</HTML>
